home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power Programmierung
/
Power-Programmierung (Tewi)(1994).iso
/
batch
/
library
/
batutl2
/
seterror.asm
< prev
next >
Wrap
Assembly Source File
|
1988-04-20
|
1KB
|
65 lines
TITLE SETERROR 4-26-84 [4-16-88]
;Toad Hall Disassembly, tweak
LF EQU 0AH
CR EQU 0DH
;
;INITIAL VALUES : CS:IP 0000:0100
; SS:SP 0000:FFFF
CodeSeg SEGMENT
ASSUME DS:CodeSeg,SS:CodeSeg,CS:CodeSeg,ES:CodeSeg
ORG 100H
SetError proc near
MOV AH,30H ;get DOS version
INT 21H
or al,al ;0 means <2.0
je BadDOS_Exit ; bad, error msg, exit
MOV SI,80H ;PSP cmd line ptr
cld ;insure fwd
lodsb ;snarf cmd line length
CMP al,2 ;2 chars (includes space)
jne Usage_Exit ; bad, exit w/help msg
lodsb ;snarf cmd line char
CMP al,' ' ;space?
jne Usage_Exit ; nope, bad, exit w/help msg
lodsb ;snarf cmd line char
CMP al,'0' ;>= 0?
jb Usage_Exit ;illegal, exit w/help msg
CMP al,'9' ;<= 9?
ja Usage_Exit ;illegal, exit w/help msg
SUB al,30H ;deAsciify as Errorlevel
MOV AH,4CH ;terminate
INT 21H
BadDOS_Exit:
mov DX,offset DOSmsg ;'requires DOS 2.0...'
MOV AH,9 ;display string
INT 21H
XOR AX,AX ;terminate
INT 21H
Usage_Exit:
mov DX,offset helpmsg
MOV AH,9 ;display string
INT 21H
MOV AX,4C00H ;terminate, Errorlevel 0
INT 21H
DOSmsg DB 'SETERROR requires DOS 2.0 or greater.',CR,LF,'$'
helpmsg DB 'SETERROR -- sets the DOS ERRORLEVEL for batch file processing'
db CR,LF
DB 'Usage:',CR,LF
DB ' SETERROR n',CR,LF
DB 'where n is between 0 and 9.',CR,LF,'$'
; DB 'SETERROR -- Copyright (C) 1983 Tony Alan Rhea'
SetError endp
CodeSeg ENDS
END SetError